<template>
	<view>
		<template v-if="list.length > 0 " >
		<!-- 消息列表 -->
		<block v-for="(item,index) in list" :key ="index" >
		  <msg-list :item ="item" :index="index" ></msg-list>
		</block>
		</template>
		<template v-else >
			<no-thing></no-thing>
		</template>
		
		<uni-popup ref="popue"  type="top">123</uni-popup>
		 <!-- <view class="flex align-center justify-center font-md border-bottom" >
			  <text class="iconfont icon-search">添加好友</text>
		  </view>
		  <view class="flex align-center justify-center font-md border-bottom" >
			  <text class="iconfont icon-shanchu">清除更表</text>
		  </view> -->
		
	</view>
</template>

<script>
	const demo = [{
					avatar:"../../static/default.jpg",
					username:"李三",
					update_time:"1611147683",
					data:"内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
					noread:20
				},
					{
						avatar:"../../static/default.jpg",
						username:"李三",
						update_time:"1611147683",
						data:"内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
						noread:20
				},
				{
						avatar:"../../static/default.jpg",
						username:"李三",
						update_time:"1611147683",
						data:"内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
						noread:20
				},
				{
						avatar:"../../static/default.jpg",
						username:"李三",
						update_time:"1611147683",
						data:"内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
						noread:20
				}]
	import msgList from "@/components/common/msg-list.vue"	
	import uniPopup from "@/components/uni_ui/uni-popup/uni-popup.vue"	
	export default {
		components:{
			msgList,
			uniPopup
		},
		data() {
			return {
				list:[]			
			}
		},
		onLoad(){
			this.list = demo
		},
		//监听下拉刷新
		onPullDownRefresh() {
			this.refresh()
		},
		//监听原生导航栏按钮事件
		onNavigationBarButtonTap(e) {
			switch (e.index){
				case 0:
					break;
				case 1:
				this.$refs.popup.open()
					break
			}
		},
	/* 	onNavigationBarButtonTap(e){
			
		}, */
		methods: {
			refresh(){
				setTimeout(( ) =>{
					this.list = demo
					//停下下拉刷新
					uni.stopPullDownRefresh()
				},2000)
			}
		}
	}
</script>

<style>

</style>
